package cn.dt67.dao.user;

import cn.dt67.pojo.User;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface UserMapper {

    //查询所有的用户信息
    List<User> findAll() throws Exception;

    //查询用户信息
    User findUser(@Param("userCode") String userCode,
                  @Param("userPassword") String userPassword)
            throws Exception;

    //查询所有的角色信息
    List<User> findUserList(@Param("userName") String userName,
                            @Param("roleId") int roleId,
                            @Param("from") int from,
                            @Param("pageSize") int pageSize) throws Exception;

    //查询所有的角色信息
    int findUserCount(@Param("userName") String userName,
                      @Param("roleId") int roleId) throws Exception;

    //保存方法
    int save(User user) throws Exception;

    //根据id获取user
    User findById(@Param("id") int id) throws Exception;

    //修改用户信息
    int update(User user) throws Exception;

    //删除用户信息
    int delete(@Param("id") int id) throws Exception;

    User userCodeExists(String userCode) throws Exception;
}
